package com.hermit.alaskagulfcustom.controller;

import com.hermit.alaskagulfcustom.feign.CustomFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author hermit
 * @data 2021/6/11
 */
@RestController
public class CustomController {

    @Autowired
    private CustomFeign customFeign;

    @GetMapping("/index")
    public String index() {
        Date date = new Date();
        String showText = "Hello Custom \n" + date;
        System.out.println(showText);
        return showText;
    }

    @ResponseBody
    @GetMapping("/get-info")
    public String getInfo() {
        System.out.println("开始消费者（custom）调用生产者（provider）");
        String showText = "消费者（custom）调用生产者（provider）：" + customFeign.index();
        System.out.println(showText);
        return showText;
    }

    @GetMapping("/test-openfeign")
    public String testOpenFeign() {
        return customFeign.testOpenFeign();
    }


}
